<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>AI导师聊天 - AI单词</title>
    <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    <style>
        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
            background-color: #f8fafc;
            height: 100vh;
            margin: 0;
            padding: 0;
        }
        .app-container {
            height: 100%;
            display: flex;
            flex-direction: column;
        }
        .nav-bar {
            height: 50px;
            background-color: white;
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 20px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
        }
        .tab-bar {
            height: 70px;
            background-color: white;
            border-top: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: space-around;
            align-items: center;
            position: fixed;
            bottom: 0;
            width: 100%;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
        }
        .tab-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            color: #6b7280;
            font-size: 10px;
        }
        .tab-item.active {
            color: #6366f1;
        }
        .tab-icon {
            font-size: 22px;
            margin-bottom: 4px;
        }
        .content {
            flex: 1;
            padding: 20px;
            overflow-y: auto;
            padding-bottom: 90px;
        }
        .chat-container {
            background-color: white;
            border-radius: 0;
            padding: 0;
            box-shadow: none;
            display: flex;
            flex-direction: column;
            height: calc(100vh - 120px);
            position: relative;
        }
        .chat-header {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
        }
        .chat-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: linear-gradient(135deg, #4f46e5, #7c3aed);
            display: flex;
            justify-content: center;
            align-items: center;
            color: white;
            font-size: 20px;
            margin-right: 12px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
        }
        .chat-name {
            font-weight: 600;
            color: #374151;
        }
        .chat-status {
            font-size: 12px;
            color: #10b981;
        }
        .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: 10px 0;
        }
        .message {
            margin-bottom: 15px;
            max-width: 80%;
        }
        .message-tutor {
            align-self: flex-start;
        }
        .message-user {
            align-self: flex-end;
            margin-left: auto;
        }
        .message-bubble {
            padding: 14px 16px;
            border-radius: 18px;
            font-size: 15px;
            line-height: 1.6;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
        }
        .message-tutor .message-bubble {
            background-color: #ffffff;
            color: #1f2937;
            border-top-left-radius: 4px;
            border: 1px solid #e5e7eb;
        }
        .message-user .message-bubble {
            background: linear-gradient(135deg, #4f46e5, #7c3aed);
            color: white;
            border-top-right-radius: 4px;
        }
        .message-time {
            font-size: 10px;
            color: #9ca3af;
            margin-top: 5px;
            text-align: right;
        }
        .chat-input {
            display: flex;
            align-items: center;
            background-color: #ffffff;
            border-radius: 0;
            padding: 12px 16px;
            position: fixed;
            bottom: 70px;
            left: 0;
            right: 0;
            z-index: 100;
            box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.05);
            border-top: 1px solid #e5e7eb;
        }
        .input-field {
            flex: 1;
            border: none;
            background: transparent;
            padding: 10px 0;
            outline: none;
            color: #4b5563;
        }
        .input-actions {
            display: flex;
            align-items: center;
        }
        .input-action {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            justify-content: center;
            align-items: center;
            color: #6b7280;
            margin-left: 8px;
        }
        .input-action.send {
            background: linear-gradient(135deg, #6366f1, #8b5cf6);
            color: white;
        }
        .word-card {
            background-color: #f3f4f6;
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 15px;
        }
        .word-title {
            font-size: 18px;
            font-weight: bold;
            color: #1f2937;
            margin-bottom: 5px;
        }
        .word-phonetic {
            color: #6b7280;
            font-size: 14px;
            margin-bottom: 10px;
        }
        .word-meaning {
            color: #4b5563;
            line-height: 1.5;
        }
    </style>
</head>
<body>
    <div class="app-container">
        <div class="nav-bar">
            <span class="font-semibold">AI互动导师</span>
            <i class="fas fa-ellipsis-h text-gray-600"></i>
        </div>
        
        <div class="content">
            <div class="chat-container">
                <div class="chat-header">
                    <div class="chat-avatar" id="tutor-avatar">
                        <i class="fas fa-user-tie"></i>
                    </div>
                    <div>
                        <div class="chat-name" id="tutor-name">严谨教授</div>
                        <div class="chat-status">在线</div>
                    </div>
                </div>
                
                <div class="chat-messages" id="chat-messages">
                    <div class="message message-tutor">
                        <div class="message-bubble">
                            你好！我是你的AI单词导师。今天我们来学习一个新单词。
                        </div>
                        <div class="message-time">10:30</div>
                    </div>
                </div>
                
                <div class="chat-input">
                    <input type="text" class="input-field" placeholder="输入你的回答..." id="user-input">
                    <div class="input-actions">
                        <div class="input-action">
                            <i class="fas fa-microphone"></i>
                        </div>
                        <div class="input-action send" onclick="sendMessage()">
                            <i class="fas fa-paper-plane"></i>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        
        <div class="tab-bar">
            <div class="tab-item" onclick="window.location.href='nft-buddy.html'">
                <i class="fas fa-dragon tab-icon"></i>
                <span>伙伴</span>
            </div>
            
            <div class="tab-item" onclick="window.location.href='word-learning.html'">
                <i class="fas fa-book tab-icon"></i>
                <span>学习</span>
            </div>
            
            <div class="tab-item active">
                <i class="fas fa-robot tab-icon"></i>
                <span>AI导师</span>
            </div>
            
            <div class="tab-item" onclick="window.location.href='story-mode.html'">
                <i class="fas fa-book-open tab-icon"></i>
                <span>故事</span>
            </div>
            
            <div class="tab-item" onclick="window.location.href='learning-report.html'">
                <i class="fas fa-chart-line tab-icon"></i>
                <span>报告</span>
            </div>
        </div>
    </div>
    
    <script>
        // 从URL参数获取导师风格
        const urlParams = new URLSearchParams(window.location.search);
        const tutorStyle = urlParams.get('style');
        
        // 根据风格设置导师信息
        switch(tutorStyle) {
            case 'strict':
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-user-tie"></i>';
                document.getElementById('tutor-name').textContent = '严谨教授';
                break;
            case 'funny':
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-microphone-alt"></i>';
                document.getElementById('tutor-name').textContent = '幽默主播';
                break;
            case 'kids':
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-child"></i>';
                document.getElementById('tutor-name').textContent = '儿童导师';
                break;
            case 'business':
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-briefcase"></i>';
                document.getElementById('tutor-name').textContent = '商务专家';
                break;
            case 'tech':
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-laptop-code"></i>';
                document.getElementById('tutor-name').textContent = '科技达人';
                break;
            case 'travel':
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-plane"></i>';
                document.getElementById('tutor-name').textContent = '旅行向导';
                break;
            default:
                document.getElementById('tutor-avatar').innerHTML = '<i class="fas fa-user-tie"></i>';
                document.getElementById('tutor-name').textContent = '严谨教授';
        }
        
        function sendMessage() {
            const input = document.getElementById('user-input');
            const message = input.value.trim();
            
            if (message) {
                // 添加用户消息
                addMessage(message, 'user');
                input.value = '';
                
                // 模拟AI回复
                setTimeout(() => {
                    const responses = {
                        'strict': '这是一个非常专业的回复，包含详细的解释和例句。',
                        'funny': '哈哈！这个问题太好笑了！让我用幽默的方式回答你...',
                        'kids': '小朋友，让我们用简单有趣的方式来学习这个单词吧！',
                        'business': '在商务场景中，这个单词通常用于...',
                        'tech': '在技术领域，这个术语指的是...',
                        'travel': '旅行时，这个词汇可以帮助你...'
                    };
                    
                    const response = responses[tutorStyle] || '这是一个默认回复。';
                    addMessage(response, 'tutor');
                }, 1000);
            }
        }
        
        function addMessage(text, sender) {
            const messagesDiv = document.getElementById('chat-messages');
            const now = new Date();
            const timeString = `${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`;
            
            const messageDiv = document.createElement('div');
            messageDiv.className = `message message-${sender}`;
            
            const bubbleDiv = document.createElement('div');
            bubbleDiv.className = 'message-bubble';
            bubbleDiv.textContent = text;
            
            const timeDiv = document.createElement('div');
            timeDiv.className = 'message-time';
            timeDiv.textContent = timeString;
            
            messageDiv.appendChild(bubbleDiv);
            messageDiv.appendChild(timeDiv);
            messagesDiv.appendChild(messageDiv);
            
            // 滚动到底部
            messagesDiv.scrollTop = messagesDiv.scrollHeight;
        }
        

        
        // 监听回车键
        inputField.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                sendMessage();
            }
        });
    </script>
</body>
</html>